<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>添加品牌</title>
    <link rel="stylesheet" href="assets/css/amazeui.min.css">
    <link rel="stylesheet" href="assets/css/app.css">
    <link rel="stylesheet" href="css/my/myOrder.css">
</head>

<body>
    <header>
        <img src="img/z-jiantou.png">
        <span>品牌管理</span>
        <a class="complete_btn" href="javascript:;">
            完成
        </a>
    </header>
    <div class="addBrand">
        <div class="h45">
            <p>品牌名称</p>
            <p>
                <input type="text" placeholder="请输入品牌名称">
            </p>
        </div>
        <div class="brandLogo">
            <p>
                品牌logo
            </p>
            <p class="fileInputImg">
                <img class="fileImg1" src="img/addImg.png" alt="">
                <input class="file_input1" type="file">
            </p>
        </div>
        <ul class="brandQualification_wrap">
            <li class="h45">品牌资质</li>
            <li class="brandQualification">
                <img class="fileImg2" src="img/show_img.png" width="110" height="100">
                <div class="fileInputImg">
                    <img class="addImg" src="img/addImg.png" width="100" height="100">
                    <input class="file_input2" type="file">
                </div>

            </li>
        </ul>
    </div>
    <script src="js/jquery-1.11.3.js"></script>
    <script>
        $(".file_input1").change(function () {
            var objUrl = getObjectURL(this.files[0]);
            if (objUrl) {
                $(".fileImg1").attr("src", objUrl);
            }
        });
        $(".file_input2").change(function () {
            var objUrl = getObjectURL(this.files[0]);
            if (objUrl) {
                $(".fileImg2").attr("src", objUrl);
            }
        });
        //建立一個可存取到該file的url
        function getObjectURL(file) {
            var url = null;
            if (window.createObjectURL != undefined) { // basic
                url = window.createObjectURL(file);
            } else if (window.URL != undefined) { // mozilla(firefox)
                url = window.URL.createObjectURL(file);
            } else if (window.webkitURL != undefined) { // webkit or chrome
                url = window.webkitURL.createObjectURL(file);
            }
            return url;
        }
    </script>
</body>

</html>